/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('openitag', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model CreateTaskDetail {
  admins?: {
    users?: [
      SimpleUser
    ](name='Users'),
  }(name='Admins'),
  allowAppendData?: boolean(name='AllowAppendData'),
  assignConfig?: TaskAssginConfig(name='AssignConfig', description='This parameter is required.'),
  datasetProxyRelations?: [
    DatasetProxyConfig
  ](name='DatasetProxyRelations', description='This parameter is required.'),
  exif?: map[string]any(name='Exif'),
  tags?: [ string ](name='Tags'),
  taskName?: string(name='TaskName', description='This parameter is required.'),
  taskTemplateConfig?: TaskTemplateConfig(name='TaskTemplateConfig'),
  taskWorkflow?: [ 
    {
      nodeName?: string(name='NodeName'),
    }
  ](name='TaskWorkflow', description='This parameter is required.'),
  templateId?: string(name='TemplateId', description='This parameter is required.'),
  UUID?: string(name='UUID', description='This parameter is required.'),
  voteConfigs?: map[string]CreateTaskDetailVoteInfo(name='VoteConfigs'),
}

model CreateTaskDetailVoteInfo {
  minVote?: long(name='MinVote', example='3'),
  voteNum?: long(name='VoteNum', example='3'),
}

model DatasetProxyConfig {
  datasetType?: string(name='DatasetType', example='LABEL'),
  source?: string(name='Source', example='PAI'),
  sourceDatasetId?: string(name='SourceDatasetId', description='This parameter is required.'),
}

model FlowJobInfo {
  display?: boolean(name='Display'),
  jobId?: string(name='JobId'),
  jobType?: string(name='JobType'),
  messageId?: string(name='MessageId'),
  processType?: string(name='ProcessType'),
  taskId?: string(name='TaskId'),
}

model Job {
  creator?: SimpleUser(name='Creator'),
  gmtCreateTime?: string(name='GmtCreateTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  jobId?: string(name='JobId'),
  jobResult?: {
    resultLink?: string(name='ResultLink'),
  }(name='JobResult'),
  jobType?: string(name='JobType'),
  status?: string(name='Status'),
}

model MarkResult {
  isNeedVoteJudge?: boolean(name='IsNeedVoteJudge', example='False'),
  markResult?: string(name='MarkResult', example='b'),
  markResultId?: string(name='MarkResultId', example='1500758849089597440'),
  markTime?: string(name='MarkTime', example='Mon Mar 07 17:02:48 CST 2022'),
  markTitle?: string(name='MarkTitle', example='单选'),
  progress?: string(name='Progress', example='None'),
  questionId?: string(name='QuestionId', example='1'),
  resultType?: string(name='ResultType', example='RADIO'),
  userMarkResultId?: string(name='UserMarkResultId', example='1500758849358032896'),
  version?: string(name='Version', example='1646643768468'),
}

model OpenDatasetProxyAppendDataRequest {
  dataMeta?: [ map[string]string ](name='DataMeta'),
  taskId?: string(name='TaskId'),
  traceId?: string(name='TraceId'),
  UUID?: string(name='UUID'),
}

model QuestionOption {
  children?: [
    QuestionOption
  ](name='Children'),
  color?: string(name='Color'),
  key?: string(name='Key', description='This parameter is required.'),
  label?: string(name='Label', description='This parameter is required.'),
  remark?: string(name='Remark'),
  shortcut?: string(name='Shortcut'),
}

model QuestionPlugin {
  canSelect?: boolean(name='CanSelect', example='False'),
  children?: [
    QuestionPlugin
  ](name='Children'),
  defaultResult?: string(name='DefaultResult', example='None'),
  display?: boolean(name='Display', description='This parameter is required.', example='True'),
  exif?: map[string]any(name='Exif'),
  hotKeyMap?: string(name='HotKeyMap', example='None'),
  markTitle?: string(name='MarkTitle', description='This parameter is required.', example='内部单选'),
  markTitleAlias?: string(name='MarkTitleAlias', example='None'),
  mustFill?: boolean(name='MustFill', description='This parameter is required.', example='False'),
  options?: [
    QuestionOption
  ](name='Options', description='This parameter is required.'),
  preOptions?: [ string ](name='PreOptions'),
  questionId?: string(name='QuestionId', description='This parameter is required.'),
  rule?: string(name='Rule', example='None'),
  selectGroup?: string(name='SelectGroup', example='None'),
  selected?: boolean(name='Selected', example='False'),
  type?: string(name='Type', description='This parameter is required.', example='RADIO'),
}

model SimpleSubtask {
  items?: [ 
    {
      abandonFlag?: boolean(name='AbandonFlag', example='False'),
      abandonRemark?: string(name='AbandonRemark', example='None'),
      dataId?: string(name='DataId', example='1957578084'),
      feedbackFlag?: boolean(name='FeedbackFlag', example='False'),
      feedbackRemark?: string(name='FeedbackRemark', example='None'),
      fixedFlag?: boolean(name='FixedFlag', example='False'),
      itemId?: long(name='ItemId', nullable=true),
      mine?: long(name='Mine', example='0'),
      rejectFlag?: boolean(name='RejectFlag', example='False'),
      state?: string(name='State', example='HANDLING'),
      weight?: long(name='Weight', example='311011'),
    }
  ](name='Items'),
  status?: string(name='Status', example='FINISHED'),
  subtaskId?: long(name='SubtaskId', example='1500682457270333440'),
}

model SimpleTask {
  archived?: boolean(name='Archived'),
  archivedInfos?: string(name='ArchivedInfos', nullable=true),
  creator?: SimpleUser(name='Creator'),
  gmtCreateTime?: string(name='GmtCreateTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  labelStyle?: string(name='LabelStyle'),
  modifier?: SimpleUser(name='Modifier'),
  refTaskId?: string(name='RefTaskId'),
  remark?: string(name='Remark', nullable=true),
  stage?: string(name='Stage'),
  status?: string(name='Status'),
  tags?: [ string ](name='Tags', nullable=true),
  taskId?: string(name='TaskId'),
  taskName?: string(name='TaskName'),
  taskType?: string(name='TaskType'),
  templateId?: string(name='TemplateId', nullable=true),
  tenantId?: string(name='TenantId'),
  UUID?: string(name='UUID'),
  workflowNodes?: [ string ](name='WorkflowNodes'),
}

model SimpleTemplate {
  abandonReasons?: string(name='AbandonReasons', example='None'),
  description?: string(name='Description'),
  gmtCreateTime?: string(name='GmtCreateTime', example='2022-07-12 14:21:08'),
  gmtModifiedTime?: string(name='GmtModifiedTime', example='2022-07-12 14:21:08'),
  sharedMode?: string(name='SharedMode', example='None'),
  status?: string(name='Status', example='DRAFT'),
  tags?: [ string ](name='Tags'),
  templateId?: string(name='TemplateId', example='1546741431673270272'),
  templateName?: string(name='TemplateName', example='图片分割组合77aa'),
  tenantId?: string(name='TenantId', example='GARDAW134'),
  type?: string(name='Type', example='CUSTOM'),
}

model SimpleTenant {
  creator?: SimpleUser(name='Creator'),
  description?: string(name='Description'),
  gmtCreateTime?: string(name='GmtCreateTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  modifier?: SimpleUser(name='Modifier'),
  role?: string(name='Role'),
  tenantId?: string(name='TenantId'),
  tenantName?: string(name='TenantName'),
  UUID?: string(name='UUID'),
}

model SimpleUser {
  accountNo?: string(name='AccountNo'),
  accountType?: string(name='AccountType', example='BUC'),
  role?: string(name='Role', nullable=true),
  userId?: long(name='UserId'),
  userName?: string(name='UserName'),
}

model SimpleWorkforce {
  userIds?: [ long ](name='UserIds'),
  workNodeId?: int32(name='WorkNodeId'),
}

model SingleTenant {
  description?: string(name='Description'),
  status?: string(name='Status'),
  tenantId?: string(name='TenantId'),
  tenantName?: string(name='TenantName'),
  UUID?: string(name='UUID'),
}

model SubtaskDetail {
  canDiscard?: boolean(name='CanDiscard'),
  canReassign?: boolean(name='CanReassign'),
  canRelease?: boolean(name='CanRelease'),
  currentWorkNode?: string(name='CurrentWorkNode', example='MARK'),
  extConfigs?: string(name='ExtConfigs', nullable=true),
  items?: [ 
    {
      abandonFlag?: boolean(name='AbandonFlag', example='False'),
      abandonRemark?: string(name='AbandonRemark', example='None'),
      dataId?: string(name='DataId', example='1957578084'),
      feedbackFlag?: boolean(name='FeedbackFlag', example='False'),
      feedbackRemark?: string(name='FeedbackRemark', example='None'),
      fixedFlag?: boolean(name='FixedFlag', example='False'),
      mine?: long(name='Mine', example='0'),
      rejectFlag?: boolean(name='RejectFlag', example='False'),
      state?: string(name='State', example='HANDLING'),
      weight?: long(name='Weight', example='311011'),
    }
  ](name='Items'),
  status?: string(name='Status', example='FINISHED'),
  subtaskId?: string(name='SubtaskId', example='1500682457270333440'),
  taskId?: string(name='TaskId'),
  weight?: long(name='Weight'),
  workNodeState?: string(name='WorkNodeState', example='FINISHED'),
  workforce?: [
    Workforce
  ](name='Workforce'),
}

model SubtaskItemDetail {
  annotations?: [ 
    {
      abandonFlag?: boolean(name='AbandonFlag', example='False'),
      abandonRemark?: string(name='AbandonRemark', example='None'),
      dataId?: string(name='DataId', example='1957578084'),
      feedbackFlag?: boolean(name='FeedbackFlag', example='False'),
      feedbackRemark?: string(name='FeedbackRemark', example='None'),
      fixedFlag?: boolean(name='FixedFlag', example='False'),
      mine?: long(name='Mine', example='0'),
      rejectFlag?: boolean(name='RejectFlag', example='False'),
      state?: string(name='State', example='HANDLING'),
      weight?: long(name='Weight', example='311011'),
    }
  ](name='Annotations'),
  dataSource?: map[string]any(name='DataSource', example='None'),
  itemId?: long(name='ItemId', example='1500758847176994816'),
}

model TaskAssginConfig {
  assignCount?: long(name='AssignCount'),
  assignField?: string(name='AssignField'),
  assignSubTaskCount?: string(name='AssignSubTaskCount'),
  assignType?: string(name='AssignType'),
}

model TaskDetail {
  admins?: [
    SimpleUser
  ](name='Admins'),
  alertTime?: long(name='AlertTime'),
  allowAppendData?: boolean(name='AllowAppendData'),
  archived?: boolean(name='Archived'),
  archivedInfos?: string(name='ArchivedInfos', nullable=true),
  assignConfig?: map[string]any(name='AssignConfig'),
  creator?: SimpleUser(name='Creator'),
  datasetProxyRelations?: [ 
    {
      datasetId?: string(name='DatasetId'),
      datasetType?: string(name='DatasetType'),
      exif?: map[string]any(name='Exif'),
      source?: string(name='Source'),
      sourceBizId?: string(name='SourceBizId'),
      sourceDatasetId?: string(name='SourceDatasetId'),
    }
  ](name='DatasetProxyRelations'),
  exif?: map[string]any(name='Exif'),
  gmtCreateTime?: string(name='GmtCreateTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  labelStyle?: string(name='LabelStyle'),
  mineConfigs?: map[string]any(name='MineConfigs'),
  modifier?: SimpleUser(name='Modifier'),
  noticeConfig?: map[string]any(name='NoticeConfig'),
  periodConfig?: map[string]any(name='PeriodConfig'),
  refTaskId?: string(name='RefTaskId'),
  relateTaskConfig?: map[string]any(name='RelateTaskConfig'),
  remark?: string(name='Remark', nullable=true),
  resultCallbackConfig?: map[string]any(name='ResultCallbackConfig'),
  stage?: string(name='Stage'),
  status?: string(name='Status'),
  tags?: [ string ](name='Tags', nullable=true),
  taskId?: string(name='TaskId'),
  taskName?: string(name='TaskName'),
  taskTemplateConfig?: {
    exif?: map[string]any(name='Exif'),
    resourceKey?: string(name='ResourceKey'),
    robotConfig?: map[string]any(name='RobotConfig'),
    selectQuestions?: [ string ](name='SelectQuestions'),
    templateOptionMap?: map[string]any(name='TemplateOptionMap'),
    templateRelationId?: string(name='TemplateRelationId'),
  }(name='TaskTemplateConfig'),
  taskType?: string(name='TaskType'),
  taskWorkflow?: [ 
    {
      exif?: map[string]any(name='Exif'),
      groups?: [ string ](name='Groups'),
      nodeName?: string(name='NodeName'),
      users?: [
        SimpleUser
      ](name='Users'),
    }
  ](name='TaskWorkflow'),
  templateId?: string(name='TemplateId', nullable=true),
  tenantId?: string(name='TenantId'),
  tenantName?: string(name='TenantName'),
  UUID?: string(name='UUID'),
  voteConfigs?: map[string]any(name='VoteConfigs'),
  workflowNodes?: [ string ](name='WorkflowNodes'),
  runMsg?: string(name='runMsg'),
}

model TaskStatistic {
  acceptItemCount?: float(name='AcceptItemCount'),
  checkAbandon?: float(name='CheckAbandon'),
  checkAccuracy?: float(name='CheckAccuracy'),
  checkEfficiency?: float(name='CheckEfficiency'),
  checkedAccuracy?: float(name='CheckedAccuracy'),
  checkedError?: float(name='CheckedError'),
  checkedRejectCount?: float(name='CheckedRejectCount'),
  finalAbandonCount?: float(name='FinalAbandonCount'),
  finishedItemCount?: long(name='FinishedItemCount'),
  finishedSubtaskCount?: long(name='FinishedSubtaskCount'),
  markEfficiency?: float(name='MarkEfficiency'),
  preMarkFixedCount?: float(name='PreMarkFixedCount', nullable=true),
  sampledAccuracy?: float(name='SampledAccuracy'),
  sampledErrorCount?: float(name='SampledErrorCount'),
  sampledRejectCount?: float(name='SampledRejectCount'),
  samplingAccuracy?: float(name='SamplingAccuracy'),
  totalCheckCount?: float(name='TotalCheckCount'),
  totalCheckTime?: float(name='TotalCheckTime'),
  totalCheckedCount?: float(name='TotalCheckedCount'),
  totalItemCount?: long(name='TotalItemCount'),
  totalMarkTime?: float(name='TotalMarkTime'),
  totalSampledCount?: float(name='TotalSampledCount'),
  totalSamplingCount?: float(name='TotalSamplingCount'),
  totalSubtaskCount?: long(name='TotalSubtaskCount'),
  totalWorkTime?: float(name='TotalWorkTime'),
}

model TaskTemplateConfig {
  exif?: map[string]string(name='Exif'),
  resourceKey?: string(name='ResourceKey'),
  selectQuestions?: [ string ](name='SelectQuestions'),
  templateOptionMap?: map[string]TaskTemplateOptionConfig(name='TemplateOptionMap'),
  templateRelationId?: string(name='TemplateRelationId'),
}

model TaskTemplateOptionConfig {
  defaultResult?: string(name='DefaultResult', nullable=false),
  options?: [
    QuestionOption
  ](name='Options', nullable=false),
  preOptions?: [ string ](name='PreOptions', nullable=false),
  rule?: string(name='Rule', nullable=false),
}

model TemplateDTO {
  classify?: string(name='Classify'),
  description?: string(name='Description'),
  exif?: map[string]any(name='Exif'),
  questionConfigs?: [
    QuestionPlugin
  ](name='QuestionConfigs', description='This parameter is required.'),
  robotConfigs?: [  map[string]any ](name='RobotConfigs'),
  sharedMode?: string(name='SharedMode'),
  tags?: [ string ](name='Tags'),
  templateId?: string(name='TemplateId'),
  templateName?: string(name='TemplateName', description='This parameter is required.'),
  viewConfigs?: {
    viewPlugins?: [
      ViewPlugin
    ](name='ViewPlugins'),
  }(name='ViewConfigs', description='This parameter is required.'),
}

model TemplateDetail {
  abandonReasons?: [ string ](name='AbandonReasons'),
  classify?: string(name='Classify'),
  creator?: SimpleUser(name='Creator'),
  description?: string(name='Description'),
  exif?: map[string]any(name='Exif'),
  gmtCreateTime?: string(name='GmtCreateTime'),
  gmtModifiedTime?: string(name='GmtModifiedTime'),
  modifier?: SimpleUser(name='Modifier'),
  questionConfigs?: [
    QuestionPlugin
  ](name='QuestionConfigs'),
  sharedMode?: string(name='SharedMode'),
  status?: string(name='Status'),
  tags?: [ string ](name='Tags'),
  templateId?: string(name='TemplateId'),
  templateName?: string(name='TemplateName'),
  tenantId?: string(name='TenantId'),
  type?: string(name='Type'),
  viewConfigs?: {
    viewPlugins?: [
      ViewPlugin
    ](name='ViewPlugins'),
  }(name='ViewConfigs'),
}

model TemplateQuestion {
  children?: [
    TemplateQuestion
  ](name='Children'),
  exif?: map[string]any(name='Exif'),
  markTitle?: string(name='MarkTitle', example='题目1'),
  options?: [
    QuestionOption
  ](name='Options'),
  preOptions?: [ string ](name='PreOptions'),
  questionId?: long(name='QuestionId', example='1'),
  type?: string(name='Type', example='RADIO/GROUP'),
}

model TemplateView {
  fields?: [ 
    {
      displayOriImg?: boolean(name='DisplayOriImg', example='True'),
      fieldName?: string(name='FieldName', example='url'),
      type?: string(name='Type', example='IMG'),
      visitInfo?: {
        aftsConf?: map[string]any(name='AftsConf'),
        ossConf?: map[string]any(name='OssConf'),
      }(name='VisitInfo'),
    }
  ](name='Fields'),
}

model UpdateTaskDTO {
  exif?: map[string]string(name='Exif'),
  remark?: string(name='Remark'),
  tags?: [ string ](name='Tags'),
  taskName?: string(name='TaskName'),
}

model UserStatistic {
  acceptedMarkItemsCount?: float(name='AcceptedMarkItemsCount'),
  checkCount?: float(name='CheckCount'),
  checkedAcceptedCount?: float(name='CheckedAcceptedCount'),
  checkedAccuracy?: float(name='CheckedAccuracy'),
  markEfficiency?: float(name='MarkEfficiency'),
  markTime?: float(name='MarkTime'),
  samplingAccuracy?: float(name='SamplingAccuracy'),
  samplingCount?: float(name='SamplingCount'),
  samplingErrorCount?: float(name='SamplingErrorCount'),
  totalMarkItemsCount?: float(name='TotalMarkItemsCount'),
  userId?: string(name='UserId'),
}

model ViewPlugin {
  bindField?: string(name='BindField', description='This parameter is required.'),
  convertor?: string(name='Convertor'),
  corsProxy?: boolean(name='CorsProxy', description='This parameter is required.'),
  displayOriImg?: boolean(name='DisplayOriImg', description='This parameter is required.'),
  exif?: map[string]any(name='Exif'),
  hide?: boolean(name='Hide'),
  plugins?: map[string]any(name='Plugins'),
  relationQuestionIds?: [ string ](name='RelationQuestionIds'),
  type?: string(name='Type', description='This parameter is required.'),
  visitInfo?: {
    aftsConf?: map[string]any(name='aftsConf'),
    ossConf?: map[string]any(name='ossConf'),
  }(name='VisitInfo'),
}

model Workforce {
  nodeType?: string(name='NodeType'),
  users?: [
    SimpleUser
  ](name='Users'),
  workNodeId?: int32(name='WorkNodeId'),
}

model AddWorkNodeWorkforceRequest {
  userIds?: [ long ](name='UserIds'),
}

model AddWorkNodeWorkforceResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model AddWorkNodeWorkforceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AddWorkNodeWorkforceResponseBody(name='body'),
}

/**
 * @summary 增加结点任务人力
 *
 * @param request AddWorkNodeWorkforceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AddWorkNodeWorkforceResponse
 */
async function addWorkNodeWorkforceWithOptions(TenantId: string, TaskId: string, WorkNodeId: string, request: AddWorkNodeWorkforceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): AddWorkNodeWorkforceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.userIds)) {
    body['UserIds'] = request.userIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddWorkNodeWorkforce',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/worknodes/${OpenApiUtil.getEncodeParam(WorkNodeId)}/workforce`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 增加结点任务人力
 *
 * @param request AddWorkNodeWorkforceRequest
 * @return AddWorkNodeWorkforceResponse
 */
async function addWorkNodeWorkforce(TenantId: string, TaskId: string, WorkNodeId: string, request: AddWorkNodeWorkforceRequest): AddWorkNodeWorkforceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return addWorkNodeWorkforceWithOptions(TenantId, TaskId, WorkNodeId, request, headers, runtime);
}

model AppendAllDataToTaskRequest {
  body?: OpenDatasetProxyAppendDataRequest(name='body'),
}

model AppendAllDataToTaskResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', description='Id of the request', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model AppendAllDataToTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AppendAllDataToTaskResponseBody(name='body'),
}

/**
 * @summary 数据追加
 *
 * @param request AppendAllDataToTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AppendAllDataToTaskResponse
 */
async function appendAllDataToTaskWithOptions(TenantId: string, TaskId: string, request: AppendAllDataToTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): AppendAllDataToTaskResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'AppendAllDataToTask',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/appendAllDataToTask`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 数据追加
 *
 * @param request AppendAllDataToTaskRequest
 * @return AppendAllDataToTaskResponse
 */
async function appendAllDataToTask(TenantId: string, TaskId: string, request: AppendAllDataToTaskRequest): AppendAllDataToTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return appendAllDataToTaskWithOptions(TenantId, TaskId, request, headers, runtime);
}

model CreateTaskRequest {
  body?: CreateTaskDetail(name='body', description='This parameter is required.'),
}

model CreateTaskResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  taskId?: string(name='TaskId', example='154***2518306500608'),
}

model CreateTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTaskResponseBody(name='body'),
}

/**
 * @summary 创建标注任务
 *
 * @param request CreateTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTaskResponse
 */
async function createTaskWithOptions(TenantId: string, request: CreateTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTaskResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTask',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建标注任务
 *
 * @param request CreateTaskRequest
 * @return CreateTaskResponse
 */
async function createTask(TenantId: string, request: CreateTaskRequest): CreateTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTaskWithOptions(TenantId, request, headers, runtime);
}

model CreateTemplateRequest {
  body?: TemplateDTO(name='body', description='This parameter is required.'),
}

model CreateTemplateResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='-'),
  errorCode?: string(name='ErrorCode', example='-'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  templateId?: string(name='TemplateId', example='152***0348342353920'),
}

model CreateTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateTemplateResponseBody(name='body'),
}

/**
 * @summary 创建标注模版
 *
 * @param request CreateTemplateRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateTemplateResponse
 */
async function createTemplateWithOptions(TenantId: string, request: CreateTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateTemplateResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'CreateTemplate',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/templates`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建标注模版
 *
 * @param request CreateTemplateRequest
 * @return CreateTemplateResponse
 */
async function createTemplate(TenantId: string, request: CreateTemplateRequest): CreateTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createTemplateWithOptions(TenantId, request, headers, runtime);
}

model CreateUserRequest {
  accountNo?: string(name='AccountNo', description='This parameter is required.', example='166***980757310'),
  accountType?: string(name='AccountType', description='This parameter is required.', example='ALIYUN'),
  role?: string(name='Role', description='This parameter is required.', example='ADMIN'),
  userName?: string(name='UserName', example='user1'),
}

model CreateUserResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  userId?: long(name='UserId', example='1662339980757311'),
}

model CreateUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateUserResponseBody(name='body'),
}

/**
 * @summary 创建租户内用户
 *
 * @param request CreateUserRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateUserResponse
 */
async function createUserWithOptions(TenantId: string, request: CreateUserRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateUserResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.accountNo)) {
    body['AccountNo'] = request.accountNo;
  }
  if (!Util.isUnset(request.accountType)) {
    body['AccountType'] = request.accountType;
  }
  if (!Util.isUnset(request.role)) {
    body['Role'] = request.role;
  }
  if (!Util.isUnset(request.userName)) {
    body['UserName'] = request.userName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateUser',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/users`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建租户内用户
 *
 * @param request CreateUserRequest
 * @return CreateUserResponse
 */
async function createUser(TenantId: string, request: CreateUserRequest): CreateUserResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createUserWithOptions(TenantId, request, headers, runtime);
}

model DeleteTaskResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model DeleteTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTaskResponseBody(name='body'),
}

/**
 * @summary 删除任务
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTaskResponse
 */
async function deleteTaskWithOptions(TenantId: string, TaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTask',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除任务
 *
 * @return DeleteTaskResponse
 */
async function deleteTask(TenantId: string, TaskId: string): DeleteTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTaskWithOptions(TenantId, TaskId, headers, runtime);
}

model DeleteTemplateResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='""'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  templateId?: string(name='TemplateId', example='152***348342353920'),
}

model DeleteTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteTemplateResponseBody(name='body'),
}

/**
 * @summary 删除租户下的单个模板
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteTemplateResponse
 */
async function deleteTemplateWithOptions(TenantId: string, TemplateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteTemplate',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/templates/${OpenApiUtil.getEncodeParam(TemplateId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除租户下的单个模板
 *
 * @return DeleteTemplateResponse
 */
async function deleteTemplate(TenantId: string, TemplateId: string): DeleteTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteTemplateWithOptions(TenantId, TemplateId, headers, runtime);
}

model DeleteUserResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model DeleteUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteUserResponseBody(name='body'),
}

/**
 * @summary 删除用户
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteUserResponse
 */
async function deleteUserWithOptions(TenantId: string, UserId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteUserResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteUser',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/users/${OpenApiUtil.getEncodeParam(UserId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除用户
 *
 * @return DeleteUserResponse
 */
async function deleteUser(TenantId: string, UserId: string): DeleteUserResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteUserWithOptions(TenantId, UserId, headers, runtime);
}

model ExportAnnotationsRequest {
  ossPath?: string(name='OssPath', description='This parameter is required.', example='oss://***-hz-oss.oss-cn-hangzhou.aliyuncs.com/output/'),
  registerDataset?: string(name='RegisterDataset', example='true'),
  target?: string(name='Target', example='PAI'),
}

model ExportAnnotationsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  flowJob?: FlowJobInfo(name='FlowJob'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model ExportAnnotationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ExportAnnotationsResponseBody(name='body'),
}

/**
 * @summary 获取任务导出结果
 *
 * @param request ExportAnnotationsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ExportAnnotationsResponse
 */
async function exportAnnotationsWithOptions(TenantId: string, TaskId: string, request: ExportAnnotationsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ExportAnnotationsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.ossPath)) {
    query['OssPath'] = request.ossPath;
  }
  if (!Util.isUnset(request.registerDataset)) {
    query['RegisterDataset'] = request.registerDataset;
  }
  if (!Util.isUnset(request.target)) {
    query['Target'] = request.target;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ExportAnnotations',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/annotations/export`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务导出结果
 *
 * @param request ExportAnnotationsRequest
 * @return ExportAnnotationsResponse
 */
async function exportAnnotations(TenantId: string, TaskId: string, request: ExportAnnotationsRequest): ExportAnnotationsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return exportAnnotationsWithOptions(TenantId, TaskId, request, headers, runtime);
}

model GetJobRequest {
  jobType?: string(name='JobType', example='DOWNLOWD_MARKRESULT_FLOW'),
}

model GetJobResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  job?: Job(name='Job'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model GetJobResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetJobResponseBody(name='body'),
}

/**
 * @summary 获取异步任务Job
 *
 * @param request GetJobRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetJobResponse
 */
async function getJobWithOptions(TenantId: string, JobId: string, request: GetJobRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetJobResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.jobType)) {
    query['JobType'] = request.jobType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetJob',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/jobs/${OpenApiUtil.getEncodeParam(JobId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取异步任务Job
 *
 * @param request GetJobRequest
 * @return GetJobResponse
 */
async function getJob(TenantId: string, JobId: string, request: GetJobRequest): GetJobResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getJobWithOptions(TenantId, JobId, request, headers, runtime);
}

model GetSubtaskResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  subtask?: SimpleSubtask(name='Subtask'),
  success?: boolean(name='Success', example='true'),
}

model GetSubtaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSubtaskResponseBody(name='body'),
}

/**
 * @summary 获取单个子任务信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSubtaskResponse
 */
async function getSubtaskWithOptions(TenantId: string, TaskID: string, SubtaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetSubtaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetSubtask',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskID)}/subtasks/${OpenApiUtil.getEncodeParam(SubtaskId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取单个子任务信息
 *
 * @return GetSubtaskResponse
 */
async function getSubtask(TenantId: string, TaskID: string, SubtaskId: string): GetSubtaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSubtaskWithOptions(TenantId, TaskID, SubtaskId, headers, runtime);
}

model GetSubtaskItemResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  item?: SubtaskItemDetail(name='Item'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model GetSubtaskItemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSubtaskItemResponseBody(name='body'),
}

/**
 * @summary 获取子任务单个ITEM信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSubtaskItemResponse
 */
async function getSubtaskItemWithOptions(TenantId: string, TaskId: string, SubtaskId: string, ItemId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetSubtaskItemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetSubtaskItem',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/subtasks/${OpenApiUtil.getEncodeParam(SubtaskId)}/items/${OpenApiUtil.getEncodeParam(ItemId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取子任务单个ITEM信息
 *
 * @return GetSubtaskItemResponse
 */
async function getSubtaskItem(TenantId: string, TaskId: string, SubtaskId: string, ItemId: string): GetSubtaskItemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSubtaskItemWithOptions(TenantId, TaskId, SubtaskId, ItemId, headers, runtime);
}

model GetTaskResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='0F01E603-8A9F-18ED-AD43-D52B5030AFA2'),
  success?: boolean(name='Success', example='true'),
  task?: TaskDetail(name='Task'),
}

model GetTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskResponseBody(name='body'),
}

/**
 * @summary 获取任务状态信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskResponse
 */
async function getTaskWithOptions(TenantId: string, TaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTask',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务状态信息
 *
 * @return GetTaskResponse
 */
async function getTask(TenantId: string, TaskId: string): GetTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskWithOptions(TenantId, TaskId, headers, runtime);
}

model GetTaskStatisticsRequest {
  statType?: string(name='StatType', example='Item'),
}

model GetTaskStatisticsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  taskStatistics?: TaskStatistic(name='TaskStatistics'),
}

model GetTaskStatisticsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskStatisticsResponseBody(name='body'),
}

/**
 * @summary 获取任务统计信息
 *
 * @param request GetTaskStatisticsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskStatisticsResponse
 */
async function getTaskStatisticsWithOptions(TenantId: string, TaskId: string, request: GetTaskStatisticsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskStatisticsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.statType)) {
    query['StatType'] = request.statType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTaskStatistics',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/statistics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务统计信息
 *
 * @param request GetTaskStatisticsRequest
 * @return GetTaskStatisticsResponse
 */
async function getTaskStatistics(TenantId: string, TaskId: string, request: GetTaskStatisticsRequest): GetTaskStatisticsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskStatisticsWithOptions(TenantId, TaskId, request, headers, runtime);
}

model GetTaskStatusResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='""'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  taskStatus?: string(name='TaskStatus', example='SUCCESS'),
}

model GetTaskStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskStatusResponseBody(name='body'),
}

/**
 * @summary 获取任务状态信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskStatusResponse
 */
async function getTaskStatusWithOptions(TenantId: string, TaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskStatusResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTaskStatus',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/status`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务状态信息
 *
 * @return GetTaskStatusResponse
 */
async function getTaskStatus(TenantId: string, TaskId: string): GetTaskStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskStatusWithOptions(TenantId, TaskId, headers, runtime);
}

model GetTaskTemplateResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='""'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  template?: TemplateDetail(name='Template'),
}

model GetTaskTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskTemplateResponseBody(name='body'),
}

/**
 * @summary 获取任务模版信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskTemplateResponse
 */
async function getTaskTemplateWithOptions(TenantId: string, TaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTaskTemplate',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/template`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务模版信息
 *
 * @return GetTaskTemplateResponse
 */
async function getTaskTemplate(TenantId: string, TaskId: string): GetTaskTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskTemplateWithOptions(TenantId, TaskId, headers, runtime);
}

model GetTaskTemplateQuestionsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  questions?: [
    QuestionPlugin
  ](name='Questions'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model GetTaskTemplateQuestionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskTemplateQuestionsResponseBody(name='body'),
}

/**
 * @summary 获取任务题目信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskTemplateQuestionsResponse
 */
async function getTaskTemplateQuestionsWithOptions(TenantId: string, TaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskTemplateQuestionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTaskTemplateQuestions',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/template/questions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务题目信息
 *
 * @return GetTaskTemplateQuestionsResponse
 */
async function getTaskTemplateQuestions(TenantId: string, TaskId: string): GetTaskTemplateQuestionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskTemplateQuestionsWithOptions(TenantId, TaskId, headers, runtime);
}

model GetTaskTemplateViewsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  views?: {
    viewPlugins?: [
      ViewPlugin
    ](name='ViewPlugins'),
  }(name='Views'),
}

model GetTaskTemplateViewsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskTemplateViewsResponseBody(name='body'),
}

/**
 * @summary 获取任务题目信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskTemplateViewsResponse
 */
async function getTaskTemplateViewsWithOptions(TenantId: string, TaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskTemplateViewsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTaskTemplateViews',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/template/views`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务题目信息
 *
 * @return GetTaskTemplateViewsResponse
 */
async function getTaskTemplateViews(TenantId: string, TaskId: string): GetTaskTemplateViewsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskTemplateViewsWithOptions(TenantId, TaskId, headers, runtime);
}

model GetTaskWorkforceResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  workforce?: [
    Workforce
  ](name='Workforce'),
}

model GetTaskWorkforceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskWorkforceResponseBody(name='body'),
}

/**
 * @summary 获取任务人力
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskWorkforceResponse
 */
async function getTaskWorkforceWithOptions(TenantId: string, TaskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskWorkforceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTaskWorkforce',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/workforce`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务人力
 *
 * @return GetTaskWorkforceResponse
 */
async function getTaskWorkforce(TenantId: string, TaskId: string): GetTaskWorkforceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskWorkforceWithOptions(TenantId, TaskId, headers, runtime);
}

model GetTaskWorkforceStatisticRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  statType?: string(name='StatType', example='Item'),
}

model GetTaskWorkforceStatisticResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
  usersStatistic?: [
    UserStatistic
  ](name='UsersStatistic'),
}

model GetTaskWorkforceStatisticResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTaskWorkforceStatisticResponseBody(name='body'),
}

/**
 * @summary 获取任务人力统计信息
 *
 * @param request GetTaskWorkforceStatisticRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTaskWorkforceStatisticResponse
 */
async function getTaskWorkforceStatisticWithOptions(TenantId: string, TaskId: string, request: GetTaskWorkforceStatisticRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetTaskWorkforceStatisticResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.statType)) {
    query['StatType'] = request.statType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetTaskWorkforceStatistic',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/workforce/statistic`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务人力统计信息
 *
 * @param request GetTaskWorkforceStatisticRequest
 * @return GetTaskWorkforceStatisticResponse
 */
async function getTaskWorkforceStatistic(TenantId: string, TaskId: string, request: GetTaskWorkforceStatisticRequest): GetTaskWorkforceStatisticResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTaskWorkforceStatisticWithOptions(TenantId, TaskId, request, headers, runtime);
}

model GetTemplateResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  template?: TemplateDetail(name='Template'),
}

model GetTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTemplateResponseBody(name='body'),
}

/**
 * @summary 获取租户下单个模板
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTemplateResponse
 */
async function getTemplateWithOptions(TenantId: string, TemplateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTemplate',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/templates/${OpenApiUtil.getEncodeParam(TemplateId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取租户下单个模板
 *
 * @return GetTemplateResponse
 */
async function getTemplate(TenantId: string, TemplateId: string): GetTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTemplateWithOptions(TenantId, TemplateId, headers, runtime);
}

model GetTemplateQuestionsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  questionConfigs?: [
    QuestionPlugin
  ](name='QuestionConfigs'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model GetTemplateQuestionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTemplateQuestionsResponseBody(name='body'),
}

/**
 * @summary 获取租户下单个模板问题
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTemplateQuestionsResponse
 */
async function getTemplateQuestionsWithOptions(TenantId: string, TemplateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTemplateQuestionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTemplateQuestions',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/templates/${OpenApiUtil.getEncodeParam(TemplateId)}/questions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取租户下单个模板问题
 *
 * @return GetTemplateQuestionsResponse
 */
async function getTemplateQuestions(TenantId: string, TemplateId: string): GetTemplateQuestionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTemplateQuestionsWithOptions(TenantId, TemplateId, headers, runtime);
}

model GetTemplateViewResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='""'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  viewConfigs?: {
    viewPlugins?: [
      ViewPlugin
    ](name='ViewPlugins'),
  }(name='ViewConfigs'),
}

model GetTemplateViewResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTemplateViewResponseBody(name='body'),
}

/**
 * @summary 获取租户下模板视图
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTemplateViewResponse
 */
async function getTemplateViewWithOptions(TenantId: string, TemplateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTemplateViewResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTemplateView',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/templates/${OpenApiUtil.getEncodeParam(TemplateId)}/views`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取租户下模板视图
 *
 * @return GetTemplateViewResponse
 */
async function getTemplateView(TenantId: string, TemplateId: string): GetTemplateViewResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTemplateViewWithOptions(TenantId, TemplateId, headers, runtime);
}

model GetTenantResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='-'),
  errorCode?: string(name='ErrorCode', example='-'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  tenant?: SingleTenant(name='Tenant'),
}

model GetTenantResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetTenantResponseBody(name='body'),
}

/**
 * @summary 获取租户信息
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetTenantResponse
 */
async function getTenantWithOptions(TenantId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetTenantResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetTenant',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取租户信息
 *
 * @return GetTenantResponse
 */
async function getTenant(TenantId: string): GetTenantResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getTenantWithOptions(TenantId, headers, runtime);
}

model GetUserResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  user?: SimpleUser(name='User'),
}

model GetUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetUserResponseBody(name='body'),
}

/**
 * @summary 获取用户
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetUserResponse
 */
async function getUserWithOptions(TenantId: string, UserId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetUserResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetUser',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/users/${OpenApiUtil.getEncodeParam(UserId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取用户
 *
 * @return GetUserResponse
 */
async function getUser(TenantId: string, UserId: string): GetUserResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getUserWithOptions(TenantId, UserId, headers, runtime);
}

model ListJobsRequest {
  jobType?: string(name='JobType', example='DOWNLOWD_MARKRESULT_FLOW'),
  pageNumber?: int32(name='PageNumber', example='20'),
  pageSize?: int32(name='PageSize', example='1'),
}

model ListJobsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  jobs?: [
    Job
  ](name='Jobs'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model ListJobsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListJobsResponseBody(name='body'),
}

/**
 * @summary 获取异步任务Job列表
 *
 * @param request ListJobsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListJobsResponse
 */
async function listJobsWithOptions(TenantId: string, request: ListJobsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListJobsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.jobType)) {
    query['JobType'] = request.jobType;
  }
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListJobs',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/jobs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取异步任务Job列表
 *
 * @param request ListJobsRequest
 * @return ListJobsResponse
 */
async function listJobs(TenantId: string, request: ListJobsRequest): ListJobsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listJobsWithOptions(TenantId, request, headers, runtime);
}

model ListSubtaskItemsRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
}

model ListSubtaskItemsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='""'),
  errorCode?: string(name='ErrorCode', example='""'),
  items?: [
    SubtaskItemDetail
  ](name='Items'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model ListSubtaskItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSubtaskItemsResponseBody(name='body'),
}

/**
 * @summary 获取子任务ITEM列表页信息
 *
 * @param request ListSubtaskItemsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSubtaskItemsResponse
 */
async function listSubtaskItemsWithOptions(TenantId: string, TaskID: string, SubtaskId: string, request: ListSubtaskItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSubtaskItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSubtaskItems',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskID)}/subtasks/${OpenApiUtil.getEncodeParam(SubtaskId)}/items`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取子任务ITEM列表页信息
 *
 * @param request ListSubtaskItemsRequest
 * @return ListSubtaskItemsResponse
 */
async function listSubtaskItems(TenantId: string, TaskID: string, SubtaskId: string, request: ListSubtaskItemsRequest): ListSubtaskItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSubtaskItemsWithOptions(TenantId, TaskID, SubtaskId, request, headers, runtime);
}

model ListSubtasksRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
}

model ListSubtasksResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  subtasks?: [
    SubtaskDetail
  ](name='Subtasks'),
  success?: boolean(name='Success', example='true'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model ListSubtasksResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSubtasksResponseBody(name='body'),
}

/**
 * @summary 获取子任务列表页信息
 *
 * @param request ListSubtasksRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSubtasksResponse
 */
async function listSubtasksWithOptions(TenantId: string, TaskID: string, request: ListSubtasksRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSubtasksResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSubtasks',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskID)}/subtasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取子任务列表页信息
 *
 * @param request ListSubtasksRequest
 * @return ListSubtasksResponse
 */
async function listSubtasks(TenantId: string, TaskID: string, request: ListSubtasksRequest): ListSubtasksResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSubtasksWithOptions(TenantId, TaskID, request, headers, runtime);
}

model ListTasksRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
}

model ListTasksResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  tasks?: [
    SimpleTask
  ](name='Tasks'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model ListTasksResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTasksResponseBody(name='body'),
}

/**
 * @summary 获取任务列表页信息
 *
 * @param request ListTasksRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTasksResponse
 */
async function listTasksWithOptions(TenantId: string, request: ListTasksRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTasksResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTasks',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取任务列表页信息
 *
 * @param request ListTasksRequest
 * @return ListTasksResponse
 */
async function listTasks(TenantId: string, request: ListTasksRequest): ListTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTasksWithOptions(TenantId, request, headers, runtime);
}

model ListTemplatesRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  searchKey?: string(name='SearchKey', example='demo'),
  types?: [ string ](name='Types'),
}

model ListTemplatesShrinkRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  searchKey?: string(name='SearchKey', example='demo'),
  typesShrink?: string(name='Types'),
}

model ListTemplatesResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  templates?: [
    SimpleTemplate
  ](name='Templates'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model ListTemplatesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTemplatesResponseBody(name='body'),
}

/**
 * @summary 获取租户模板信息列表
 *
 * @param tmpReq ListTemplatesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTemplatesResponse
 */
async function listTemplatesWithOptions(TenantId: string, tmpReq: ListTemplatesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTemplatesResponse {
  Util.validateModel(tmpReq);
  var request = new ListTemplatesShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!Util.isUnset(tmpReq.types)) {
    request.typesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.types, 'Types', 'simple');
  }
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.searchKey)) {
    query['SearchKey'] = request.searchKey;
  }
  if (!Util.isUnset(request.typesShrink)) {
    query['Types'] = request.typesShrink;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTemplates',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/templates`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取租户模板信息列表
 *
 * @param request ListTemplatesRequest
 * @return ListTemplatesResponse
 */
async function listTemplates(TenantId: string, request: ListTemplatesRequest): ListTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTemplatesWithOptions(TenantId, request, headers, runtime);
}

model ListTenantsRequest {
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
}

model ListTenantsResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='-'),
  errorCode?: string(name='ErrorCode', example='-'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  tenants?: [
    SimpleTenant
  ](name='Tenants'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
}

model ListTenantsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTenantsResponseBody(name='body'),
}

/**
 * @summary 获取租户列表
 *
 * @param request ListTenantsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTenantsResponse
 */
async function listTenantsWithOptions(request: ListTenantsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListTenantsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListTenants',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取租户列表
 *
 * @param request ListTenantsRequest
 * @return ListTenantsResponse
 */
async function listTenants(request: ListTenantsRequest): ListTenantsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listTenantsWithOptions(request, headers, runtime);
}

model ListUsersRequest {
  pageNumber?: int32(name='PageNumber', example='20'),
  pageSize?: int32(name='PageSize', example='1'),
}

model ListUsersResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  pageNumber?: int32(name='PageNumber', example='1'),
  pageSize?: int32(name='PageSize', example='20'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  totalCount?: int32(name='TotalCount', example='22'),
  totalPage?: int32(name='TotalPage', example='2'),
  users?: [
    SimpleUser
  ](name='Users'),
}

model ListUsersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListUsersResponseBody(name='body'),
}

/**
 * @summary 获取用户列表
 *
 * @param request ListUsersRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListUsersResponse
 */
async function listUsersWithOptions(TenantId: string, request: ListUsersRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListUsersResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListUsers',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/users`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取用户列表
 *
 * @param request ListUsersRequest
 * @return ListUsersResponse
 */
async function listUsers(TenantId: string, request: ListUsersRequest): ListUsersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listUsersWithOptions(TenantId, request, headers, runtime);
}

model RemoveWorkNodeWorkforceRequest {
  userIds?: [ long ](name='UserIds'),
}

model RemoveWorkNodeWorkforceResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='""'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model RemoveWorkNodeWorkforceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RemoveWorkNodeWorkforceResponseBody(name='body'),
}

/**
 * @summary 删除结点人力
 *
 * @param request RemoveWorkNodeWorkforceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RemoveWorkNodeWorkforceResponse
 */
async function removeWorkNodeWorkforceWithOptions(TenantId: string, TaskId: string, WorkNodeId: string, request: RemoveWorkNodeWorkforceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RemoveWorkNodeWorkforceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.userIds)) {
    body['UserIds'] = request.userIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RemoveWorkNodeWorkforce',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/worknodes/${OpenApiUtil.getEncodeParam(WorkNodeId)}/workforce`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除结点人力
 *
 * @param request RemoveWorkNodeWorkforceRequest
 * @return RemoveWorkNodeWorkforceResponse
 */
async function removeWorkNodeWorkforce(TenantId: string, TaskId: string, WorkNodeId: string, request: RemoveWorkNodeWorkforceRequest): RemoveWorkNodeWorkforceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return removeWorkNodeWorkforceWithOptions(TenantId, TaskId, WorkNodeId, request, headers, runtime);
}

model UpdateTaskRequest {
  body?: UpdateTaskDTO(name='body', description='This parameter is required.'),
}

model UpdateTaskResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model UpdateTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTaskResponseBody(name='body'),
}

/**
 * @summary 更新标注任务基础信息
 *
 * @param request UpdateTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateTaskResponse
 */
async function updateTaskWithOptions(TenantId: string, TaskId: string, request: UpdateTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateTaskResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTask',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新标注任务基础信息
 *
 * @param request UpdateTaskRequest
 * @return UpdateTaskResponse
 */
async function updateTask(TenantId: string, TaskId: string, request: UpdateTaskRequest): UpdateTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateTaskWithOptions(TenantId, TaskId, request, headers, runtime);
}

model UpdateTaskWorkforceRequest {
  workforce?: [
    SimpleWorkforce
  ](name='Workforce'),
}

model UpdateTaskWorkforceResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='""'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model UpdateTaskWorkforceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTaskWorkforceResponseBody(name='body'),
}

/**
 * @summary 更新任务人力
 *
 * @param request UpdateTaskWorkforceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateTaskWorkforceResponse
 */
async function updateTaskWorkforceWithOptions(TenantId: string, TaskId: string, request: UpdateTaskWorkforceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateTaskWorkforceResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.workforce)) {
    body['Workforce'] = request.workforce;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTaskWorkforce',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/tasks/${OpenApiUtil.getEncodeParam(TaskId)}/workforce`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新任务人力
 *
 * @param request UpdateTaskWorkforceRequest
 * @return UpdateTaskWorkforceResponse
 */
async function updateTaskWorkforce(TenantId: string, TaskId: string, request: UpdateTaskWorkforceRequest): UpdateTaskWorkforceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateTaskWorkforceWithOptions(TenantId, TaskId, request, headers, runtime);
}

model UpdateTemplateRequest {
  body?: TemplateDTO(name='body'),
}

model UpdateTemplateResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  templateId?: string(name='TemplateId', example='1529360348342353920'),
}

model UpdateTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTemplateResponseBody(name='body'),
}

/**
 * @summary 更新标注模版
 *
 * @param request UpdateTemplateRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateTemplateResponse
 */
async function updateTemplateWithOptions(TenantId: string, TemplateId: string, request: UpdateTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateTemplateResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(request.body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTemplate',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/templates/${OpenApiUtil.getEncodeParam(TemplateId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新标注模版
 *
 * @param request UpdateTemplateRequest
 * @return UpdateTemplateResponse
 */
async function updateTemplate(TenantId: string, TemplateId: string, request: UpdateTemplateRequest): UpdateTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateTemplateWithOptions(TenantId, TemplateId, request, headers, runtime);
}

model UpdateTenantRequest {
  description?: string(name='Description', example='demo'),
  tenantName?: string(name='TenantName'),
}

model UpdateTenantResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
}

model UpdateTenantResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateTenantResponseBody(name='body'),
}

/**
 * @summary 更新租户信息
 *
 * @param request UpdateTenantRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateTenantResponse
 */
async function updateTenantWithOptions(TenantId: string, request: UpdateTenantRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateTenantResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.description)) {
    body['Description'] = request.description;
  }
  if (!Util.isUnset(request.tenantName)) {
    body['TenantName'] = request.tenantName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateTenant',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新租户信息
 *
 * @param request UpdateTenantRequest
 * @return UpdateTenantResponse
 */
async function updateTenant(TenantId: string, request: UpdateTenantRequest): UpdateTenantResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateTenantWithOptions(TenantId, request, headers, runtime);
}

model UpdateUserRequest {
  role?: string(name='Role', description='This parameter is required.', example='ADMIN'),
  userName?: string(name='UserName', description='This parameter is required.', example='user1'),
}

model UpdateUserResponseBody = {
  code?: int32(name='Code', example='0'),
  details?: string(name='Details', example='null'),
  errorCode?: string(name='ErrorCode', example='""'),
  message?: string(name='Message', description='This parameter is required.', example='success'),
  requestId?: string(name='RequestId', example='90ABA848-AD74-1F6E-84BC-4182A7F1F29E'),
  success?: boolean(name='Success', example='true'),
  userId?: string(name='UserId', example='166***980757311'),
}

model UpdateUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateUserResponseBody(name='body'),
}

/**
 * @summary 更新用户信息
 *
 * @param request UpdateUserRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateUserResponse
 */
async function updateUserWithOptions(TenantId: string, UserId: string, request: UpdateUserRequest, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateUserResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.role)) {
    body['Role'] = request.role;
  }
  if (!Util.isUnset(request.userName)) {
    body['UserName'] = request.userName;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'UpdateUser',
    version = '2022-06-16',
    protocol = 'HTTPS',
    pathname = `/openapi/api/v1/tenants/${OpenApiUtil.getEncodeParam(TenantId)}/users/${OpenApiUtil.getEncodeParam(UserId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新用户信息
 *
 * @param request UpdateUserRequest
 * @return UpdateUserResponse
 */
async function updateUser(TenantId: string, UserId: string, request: UpdateUserRequest): UpdateUserResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateUserWithOptions(TenantId, UserId, request, headers, runtime);
}

